package com.sunwayworld.basemodule.common.asynctask.config;

import com.sunwayworld.basemodule.common.asynctask.ssl.HttpsClientRequestFactory;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.http.client.SimpleClientHttpRequestFactory;
import org.springframework.web.client.RestTemplate;

@Configuration
public class BeanConfiguration {

    @Bean
    RestTemplate httpRestTemplate(){
        SimpleClientHttpRequestFactory requestFactory = new SimpleClientHttpRequestFactory();
        requestFactory.setConnectTimeout(1500);
        requestFactory.setReadTimeout(1500);
        return new RestTemplate(requestFactory);
    }
    @Bean
    RestTemplate httpsRestTemplate(){
        SimpleClientHttpRequestFactory requestFactory = new HttpsClientRequestFactory();
        requestFactory.setConnectTimeout(1500);
        requestFactory.setReadTimeout(1500);
        return new RestTemplate(requestFactory);
    }
}
